<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table border="1">
  <tr>
    <th>商品标题</th>
    <th>商品价格</th>
    <th>商品销量</th>
  </tr>
</table>
<script>
  let p1={}
  p1.name="ph"
  p1.age = 23
  p1.run = function (){
    console.log(this.name+":"+this.age)
  }
  p1.run()
  let p2 = {
    name:"zwy",
    age:25,
    run:function () {
      console.log(this.name+":"+this.age)
    }
  }
  p2.run()

  let arr=[{title:"小米手机",price:5000,saleCount:200},
          {title:"回力鞋" ,price:100,saleCount:1000},
          {title:"高达",price:300,saleCount:300},
          {title:"梵天丸",price:800,saleCount:1200},]
  let tb = document.querySelector("table")

  for (let product of arr) {
    let tr = document.createElement("tr");
    let titleTd = document.createElement("td");
    let priceTd = document.createElement("td");
    let saleCountTd = document.createElement("td");
    titleTd.innerText=product.title;
    priceTd.innerText=product.price;
    saleCountTd.innerText=product.saleCount;
    tr.append(titleTd,priceTd,saleCountTd)
    tb.append(tr)
  }
</script>
</body>
</html>